#ifndef __V4L2CAPTURETHREAD_H_
#define __V4L2CAPTURETHREAD_H_
#include "V4L2Controller.h"
//#include "StreamServer.h"
#include "OSThread.h"
#include "OSMutex.h"
#include "OSCond.h"

class V4L2CaptureThread : public OSThread
{
public:
	V4L2CaptureThread();
	~V4L2CaptureThread();
	int Initialize(/*StreamServer* m_pServer*/);
	virtual void Entry();

    unsigned char* GetFrameBuffer() {return m_frameBuffer;}
    int GetFrameSize() {return m_frameSize;}
    struct timeval& GetFrametimestamp() {return m_frametimestamp;}
    OSMutex* GetMutex(){return &m_mutex;}
    OSCond* GetCond(){return &m_cond;}
private:
	int CopyPicture();
private:
	V4L2Controller m_Controller;
	int m_frameSize;
	struct timeval m_frametimestamp;
	unsigned char* m_frameBuffer;
	//StreamServer *m_pServer;

    OSMutex m_mutex;
    OSCond m_cond;
};

#endif
